Imports StartPoint.BR.Interfaces
Imports StartFrame.BR.Interfaces

Namespace Compras.Listados

    Public Class Deudas
        Inherits StartFrame.US.Listador

        Dim _Facturas As IConsultaFacturasC

#Region " Windows Form Designer generated code "

        Public Sub New()
            MyBase.New()

            'This call is required by the Windows Form Designer.
            InitializeComponent()

            'Add any initialization after the InitializeComponent() call

        End Sub

        'Form overrides dispose to clean up the component list.
        Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
                If Not (components Is Nothing) Then
                    components.Dispose()
                End If
            End If
            MyBase.Dispose(disposing)
        End Sub

        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer

        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        Friend WithEvents cd_proveedor As LnkDesdeHastaFK
        Friend WithEvents cd_transaccion As LnkDesdeHastaFK
        Friend WithEvents cd_unidad_monetaria As LnkDesdeHastaFK
        Friend WithEvents fe_devengamiento As LnkDesdeHastaFecha
        Friend WithEvents fe_vencimiento As LnkDesdeHastaFecha
        Friend WithEvents chk_debitos As LnkControls.LnkCheckBox
        Friend WithEvents chk_creditos As LnkControls.LnkCheckBox
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
            Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Deudas))
            Me.cd_proveedor = New LnkDesdeHastaFK
            Me.cd_transaccion = New LnkDesdeHastaFK
            Me.cd_unidad_monetaria = New LnkDesdeHastaFK
            Me.fe_devengamiento = New LnkDesdeHastaFecha
            Me.fe_vencimiento = New LnkDesdeHastaFecha
            Me.chk_debitos = New LnkControls.LnkCheckBox
            Me.chk_creditos = New LnkControls.LnkCheckBox
            Me.Contenedor.SuspendLayout()
            CType(Me.lnk_dataSet, System.ComponentModel.ISupportInitialize).BeginInit()
            '
            'lblTitulo
            '
            Me.lblTitulo.Name = "lblTitulo"
            Me.lblTitulo.Text = "Deudas y Creditos"
            '
            'lblReporte
            '
            Me.lblReporte.Location = New System.Drawing.Point(20, 58)
            Me.lblReporte.Name = "lblReporte"
            '
            'cboReporte
            '
            Me.cboReporte.Location = New System.Drawing.Point(150, 52)
            Me.cboReporte.Name = "cboReporte"
            Me.cboReporte.Size = New System.Drawing.Size(309, 21)
            Me.cboReporte.ValueMember = "ID"
            '
            'StatusBar1
            '


            '
            'Contenedor
            '
            Me.Contenedor.Controls.Add(Me.chk_creditos)
            Me.Contenedor.Controls.Add(Me.chk_debitos)
            Me.Contenedor.Controls.Add(Me.fe_vencimiento)
            Me.Contenedor.Controls.Add(Me.fe_devengamiento)
            Me.Contenedor.Controls.Add(Me.cd_unidad_monetaria)
            Me.Contenedor.Controls.Add(Me.cd_transaccion)
            Me.Contenedor.Controls.Add(Me.cd_proveedor)
            Me.Contenedor.Name = "Contenedor"
            Me.Contenedor.Size = New System.Drawing.Size(477, 246)
            '
            'TabPage1
            '
            Me.TabPage1.Name = "TabPage1"
            Me.TabPage1.Size = New System.Drawing.Size(481, 319)
            '
            'cmdMinimizar
            '
            Me.cmdMinimizar.Image = CType(resources.GetObject("cmdMinimizar.Image"), System.Drawing.Image)
            Me.cmdMinimizar.Name = "cmdMinimizar"
            '
            'cd_proveedor
            '
            Me.cd_proveedor.BackColor = System.Drawing.SystemColors.ControlLight
            Me.cd_proveedor.Desde = ""
            Me.cd_proveedor.Hasta = "zzzzzzzzzz"
            Me.cd_proveedor.Location = New System.Drawing.Point(128, 72)
            Me.cd_proveedor.LvCampo = "cd_proveedor"
            Me.cd_proveedor.LvTabla = "kad_proveedores"
            Me.cd_proveedor.LvWhere = Nothing
            Me.cd_proveedor.Name = "cd_proveedor"
            Me.cd_proveedor.Size = New System.Drawing.Size(280, 20)
            Me.cd_proveedor.TabIndex = 7
            Me.cd_proveedor.Valida = False
            '
            'cd_transaccion
            '
            Me.cd_transaccion.BackColor = System.Drawing.SystemColors.ControlLight
            Me.cd_transaccion.Desde = ""
            Me.cd_transaccion.Hasta = "zzzzzzzzzz"
            Me.cd_transaccion.Location = New System.Drawing.Point(128, 8)
            Me.cd_transaccion.LvCampo = "cd_transaccion"
            Me.cd_transaccion.LvTabla = "wad_transacciones"
            Me.cd_transaccion.LvWhere = "nm_subsistema='COMPRAS'"
            Me.cd_transaccion.Name = "cd_transaccion"
            Me.cd_transaccion.Size = New System.Drawing.Size(280, 20)
            Me.cd_transaccion.TabIndex = 5
            Me.cd_transaccion.Valida = False
            '
            'cd_unidad_monetaria
            '
            Me.cd_unidad_monetaria.BackColor = System.Drawing.SystemColors.ControlLight
            Me.cd_unidad_monetaria.Desde = ""
            Me.cd_unidad_monetaria.Hasta = "zzzzzzzzzz"
            Me.cd_unidad_monetaria.Location = New System.Drawing.Point(128, 40)
            Me.cd_unidad_monetaria.LvCampo = "cd_unidad_monetaria"
            Me.cd_unidad_monetaria.LvTabla = "wad_unidades_monetarias"
            Me.cd_unidad_monetaria.LvWhere = Nothing
            Me.cd_unidad_monetaria.Name = "cd_unidad_monetaria"
            Me.cd_unidad_monetaria.Size = New System.Drawing.Size(280, 20)
            Me.cd_unidad_monetaria.TabIndex = 6
            Me.cd_unidad_monetaria.Valida = False
            '
            'fe_devengamiento
            '
            Me.fe_devengamiento.BackColor = System.Drawing.SystemColors.ControlLight
            Me.fe_devengamiento.Desde = New Date(2000, 1, 1, 0, 0, 0, 0)
            Me.fe_devengamiento.Hasta = New Date(2003, 11, 11, 0, 0, 0, 0)
            Me.fe_devengamiento.Location = New System.Drawing.Point(128, 104)
            Me.fe_devengamiento.Name = "fe_devengamiento"
            Me.fe_devengamiento.Size = New System.Drawing.Size(176, 20)
            Me.fe_devengamiento.TabIndex = 8
            '
            'fe_vencimiento
            '
            Me.fe_vencimiento.BackColor = System.Drawing.SystemColors.ControlLight
            Me.fe_vencimiento.Desde = New Date(2000, 1, 1, 0, 0, 0, 0)
            Me.fe_vencimiento.Hasta = New Date(2003, 11, 11, 0, 0, 0, 0)
            Me.fe_vencimiento.Location = New System.Drawing.Point(128, 200)
            Me.fe_vencimiento.Name = "fe_vencimiento"
            Me.fe_vencimiento.Size = New System.Drawing.Size(176, 20)
            Me.fe_vencimiento.TabIndex = 11
            '
            'chk_debitos
            '
            Me.chk_debitos.Checked = True
            Me.chk_debitos.CheckState = System.Windows.Forms.CheckState.Checked
            Me.chk_debitos.ForeColor = System.Drawing.SystemColors.ActiveCaption
            Me.chk_debitos.Location = New System.Drawing.Point(128, 136)
            Me.chk_debitos.Name = "chk_debitos"
            Me.chk_debitos.Size = New System.Drawing.Size(184, 24)
            Me.chk_debitos.TabIndex = 9
            Me.chk_debitos.Text = "Listar todos los debitos"
            '
            'chk_creditos
            '
            Me.chk_creditos.Checked = True
            Me.chk_creditos.CheckState = System.Windows.Forms.CheckState.Checked
            Me.chk_creditos.ForeColor = System.Drawing.SystemColors.ActiveCaption
            Me.chk_creditos.Location = New System.Drawing.Point(128, 168)
            Me.chk_creditos.Name = "chk_creditos"
            Me.chk_creditos.Size = New System.Drawing.Size(184, 24)
            Me.chk_creditos.TabIndex = 10
            Me.chk_creditos.Text = "Listar todos los creditos"
            '
            'Deudas
            '
            Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
            Me.BackgroundImage = Nothing
            Me.ClientSize = New System.Drawing.Size(564, 399)
            Me.Name = "Deudas"
            Me.Text = "KLDeudas"
            Me.Contenedor.ResumeLayout(False)
            CType(Me.lnk_dataSet, System.ComponentModel.ISupportInitialize).EndInit()

        End Sub

#End Region

        'Este evento se dispara al cargar el formulario, e inicializa el mismo cargando
        ' determinados valores por defecto
        Private Sub KLDeudas_OnLoadForm(ByRef reportCollection As StartFrame.US.Listador.Reports) Handles MyBase.OnLoadForm
            Try
                'Establece las fechas parametros por defecto
                Dim fecha As ISql = CType(RemotingHelper.getObject(GetType(ISql)), ISql)

                fe_devengamiento.Hasta = fecha.GetDate(ISql.Formato.Fecha)
                fe_vencimiento.Hasta = fecha.GetDate(ISql.Formato.Fecha)
                'MPM
                fe_devengamiento.Desde = fecha.GetDate(ISql.Formato.Fecha)
                fe_vencimiento.Desde = fecha.GetDate(ISql.Formato.Fecha)

                'Asigna los reportes
                Dim rpt1 As Report
                Dim rpt2 As Report

                'Rangos para el reporte Pagos por proveedor
                'rpt = New Report(1, "NombreReporte", "Titulo del combo", "Stored proc", "Assembly")   
                '"Assembly" = --> "US.spmc.compras.reportes" para este modulo
                Dim rangoTransaccion As New Rango(1, "cd_transaccion", cd_transaccion)
                Dim rangoUnidadMonetaria As New Rango(2, "cd_unidad_monetaria", cd_unidad_monetaria)
                Dim rangoProveedor As New Rango(3, "cd_proveedor", cd_proveedor)
                Dim rangoFe_Devengamiento As New Rango(4, "fe_devengamiento", fe_devengamiento)
                Dim rangoDebitos As New Rango(5, "Debitos", chk_debitos)
                Dim rangoCreditos As New Rango(6, "Creditos", chk_creditos)
                Dim rangoFe_Vencimiento As New Rango(7, "fe_vencimiento", fe_vencimiento)

                rpt1 = New Report(1, "KLdeudas_resumidoproveedor", "Resumido por Proveedor", "kldeudas_resumidoproveedor", "US.spmc.compras.reportes")
                rpt1.Rangos.Add(rangoTransaccion)
                rpt1.Rangos.Add(rangoUnidadMonetaria)
                rpt1.Rangos.Add(rangoProveedor)
                rpt1.Rangos.Add(rangoFe_Devengamiento)
                rpt1.Rangos.Add(rangoDebitos)
                rpt1.Rangos.Add(rangoCreditos)

                rpt2 = New Report(1, "KLdeudas_vencimientos", "Vencimientos", "kldeudas_vencimientos", "US.spmc.compras.reportes")
                rpt2.Rangos.Add(rangoTransaccion)
                rpt2.Rangos.Add(rangoUnidadMonetaria)
                rpt2.Rangos.Add(rangoProveedor)
                rpt2.Rangos.Add(rangoFe_Devengamiento)
                rpt2.Rangos.Add(rangoDebitos)
                rpt2.Rangos.Add(rangoCreditos)
                rpt2.Rangos.Add(rangoFe_Vencimiento)

                reportCollection.Add(rpt1)
                reportCollection.Add(rpt2)

                'Referencia el objeto de negocios relacionado
                _Facturas = CType(RemotingHelper.getObject(GetType(IConsultaFacturasC)), IConsultaFacturasC)
                Me.ObjetoReglasNegocio = _Facturas

            Catch ex As Exception
                StartFrame.US.Display.ShowError(ex.Message)
            End Try
        End Sub

    End Class

End Namespace